Odoo / Model / Relational fields
Relation Field
-
Step 1:
1. Many2one : Store a relation against a co-model:
arel_id = fields.Many2one('res.users') arel_id = fields.Many2one(comodel_name='res.users') an_other_rel_id = fields.Many2one(comodel_name='res.partner', delegate=True) 2. One2many : Store a relation against many rows of co-model:
arel_ids = fields.One2many('res.users', 'rel_id') arel_ids = fields.One2many(comodel_name='res.users', inverse_name='rel_id') 3. Many2many : Store a relation against many2many rows of co-model:
arel_ids = fields.Many2many('res.users') arel_ids = fields.Many2many(comodel_name='res.users', relation='table_name', column1='col_name', column2='other_col_name')